<template>
  <div v-if="visible">
    <el-dialog :visible.sync="visible"
               title=""
               :modal="false"
               class="user-dialog add-or-updata"
               width="30%"
               :before-close="closeDialog"
               :close-on-click-modal="false"
               :close-on-press-escape="false">
      <el-form :model="dataForm"
               class="label-left-form"
               v-loading="dataListLoading"
               style="overflow: hidden;"
               :element-loading-text="$t('loading')"
               ref="dataForm"
               label-position="left"
               label-width="96px">
        <el-form-item prop="sonName"
                      label="子系统名称：">
          <span>{{ dataForm.sonName }}</span>
        </el-form-item>
        <el-form-item prop="moudleName"
                      label="模块：">
          <span>{{ dataForm.moudleName }}</span>
        </el-form-item>
        <el-form-item prop="examineWay"
                      label="审批方式：">
          <span>{{ dataForm.examineWay }}</span>
        </el-form-item>
        <el-form-item v-if="dataForm.examineWay !== '系统'"
                      prop="platformName"
                      label="平台名称：">
          <span>{{ dataForm.platformName }}</span>
        </el-form-item>
        <el-form-item v-if="dataForm.examineWay !== '系统'"
                      prop="flowId"
                      label="流程ID：">
          <span>{{ dataForm.flowId }}</span>
        </el-form-item>
        <el-form-item v-if="dataForm.examineWay !== '系统'"
                      prop="userId"
                      label="用户ID：">
          <span>{{ dataForm.userId }}</span>
        </el-form-item>
      </el-form>
      <template slot="footer">
        <el-button @click="closeDialog()">{{ $t('cancel') }}</el-button>
      </template>
    </el-dialog>
  </div>
</template>

<script>
// import debounce from 'lodash/debounce'
import mixinViewModule from '@/mixins/view-module'
import minFormValidate from '@/mixins/form-validate'
export default {
  mixins: [mixinViewModule, minFormValidate],
  data () {
    return {
      mixinViewModuleOptions: {
        updateURL: '/tb/examine/updateExamine'
      },
      visible: false,
      auditOptions: [
        {
          label: '系统',
          value: '0'
        },
        {
          label: '泛微OA',
          value: '1'
        }
      ],
      dataForm: {
        sonName: '',
        id: '',
        moudleName: '',
        examineWay: '',
        createDate: ''
      }
    }
  },
  methods: {
    closeDialog () {
      this.visible = false
      this.$refs['dataForm'].resetFields()
    },
    init (data) {
      this.dataForm.id = data.id
      if (data.sonName === '0') {
        this.dataForm.sonName = '会务管理系统'
      }
      if (data.sonName === '1') {
        this.dataForm.sonName = '访客管理系统'
      }
      if (data.sonName === '2') {
        this.dataForm.sonName = '车辆管理系统'
      }
      if (data.sonName === '3') {
        this.dataForm.sonName = '宿舍管理系统'
      }
      if (data.sonName === '4') {
        this.dataForm.sonName = '门禁管理系统'
      }
      if (data.sonName === '5') {
        this.dataForm.sonName = '健身房管理系统'
      }
      if (data.sonName === '6') {
        this.dataForm.sonName = '物流车管理系统'
      }
      if (data.moudleName === '0') {
        this.dataForm.moudleName = '会议室预约'
      }
      if (data.moudleName === '1') {
        this.dataForm.moudleName = '访客申请'
      }
      if (data.moudleName === '2') {
        this.dataForm.moudleName = '用车申请'
      }
      if (data.moudleName === '3') {
        this.dataForm.moudleName = '物流车来访申请'
      }
      if (data.moudleName === '4') {
        this.dataForm.moudleName = '员工入住申请'
      }
      if (data.moudleName === '5') {
        this.dataForm.moudleName = '员工调宿申请'
      }
      if (data.moudleName === '6') {
        this.dataForm.moudleName = '临时入住登记'
      }
      if (data.moudleName === '7') {
        this.dataForm.moudleName = '门禁申请'
      }
      if (data.moudleName === '8') {
        this.dataForm.moudleName = '健身房申请'
      }
      if (data.moudleName === '9') {
        this.dataForm.moudleName = '物流车申请'
      }
      if (data.moudleName === '11') {
        this.dataForm.moudleName = '停车申请'
      }
      if (data.examineWay === 10) {
        this.dataForm.examineWay = '系统'
      }
      if (data.examineWay === 1) {
        this.dataForm.examineWay = '泛微'
      }
      if (data.examineWay === 2) {
        this.dataForm.examineWay = '企业微信'
      }
      this.dataForm.flowId = data.flowId
      this.dataForm.userId = data.userId
      this.dataForm.createDate = data.createDate
      this.dataForm.platformName = data.platformName
      this.visible = true
    }
  }
}
</script>

<style lang="scss" scoped>
::deep .el-select {
  width: 100%;
}
</style>
